package com.gofaraway.service.juc;

import lombok.SneakyThrows;

import java.util.concurrent.TimeUnit;

/**
 * 普通线程
 *
 * @author ChenPeng
 * @Date 2024/3/22 9:49
 */
public class Demo1 {


    public static void main(String[] args) {


        ThreadDemo threadDemo = new ThreadDemo();
        threadDemo.start();

        new Thread(new RunnableDemo()).start();

        System.out.println("--------main run-----------");

    }
}


class ThreadDemo extends Thread {

    @SneakyThrows
    @Override
    public void run() {
        TimeUnit.MILLISECONDS.sleep(1000);
        System.out.println("--------ThreadDemo run-----------");
    }
}

class RunnableDemo implements Runnable {


    @Override
    public void run() {
        System.out.println("--------RunnableDemo run-----------");
    }
}
